
package com.mc.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

import org.apache.log4j.Logger;

public class StringUtil {
	/**
	 * Logger for this class
	 */
	private static StringUtil stringutil = new StringUtil();
	private static final Logger logger = Logger.getLogger(StringUtil.class);
    private List<String> filepaths = new ArrayList<String>();
    private String filepath = "";
    private  StringUtil(){}
    public static StringUtil getInstace()
    {
    	if(stringutil==null)
    	{
    		stringutil = new StringUtil();	
    	}
    	return stringutil;
    }
    @SuppressWarnings("static-access")
	public static String []splitAConStr(String str)
    {
    //	String result = "";
    	String [] strs= {};
    	strs = str.split(":");
    	//Character f = strs[0].charAt(0);
    	//f.toUpperCase(0);
    	strs[0] = "set" + Character.toUpperCase(strs[0].charAt(0)) + strs[0].substring(1);
    	//logger.info(strs[0] + " " + strs[1]);
    	return strs;
    }
	public List<String> getFilepaths() {
		return filepaths;
	}
	public void setFilepaths(List<String> filepaths) {
		this.filepaths = filepaths;
	}
	public void addfilepath(String filepath)
	{
		this.filepaths.add(filepath);
	}
	 /**
     * 根据路径参数获取相应前台页面
     * @param path
     * @return
     */
    public static String getPageName(String path){
    	String result = "";
    	Properties properties = new Properties();
    	try{
    		properties.load(StringUtil.class.getClassLoader().
    				getResourceAsStream("com/mc/utils/path.properties"));
    		result = properties.getProperty(path);
    	}catch(Exception e){
    		logger.error("读取属性文件失败\n信息如下:"+e.getLocalizedMessage());
    	}
    	return result;
    }
}

